# -*- coding: utf-8 -*-
# @Time        :2025/4/21 14:08
# @Author      :文刀水寿
# @File        : main.py
"""
 @Description :
"""
from fastapi import FastAPI, Request
import uvicorn
from fastapi.templating import Jinja2Templates

app = FastAPI()

templates = Jinja2Templates(directory="templates")


@app.get("/index")
def index(request: Request):
    name = "root"
    age = 299
    return templates.TemplateResponse(
        "index.html",  # 模板文件
        {
            "request":request,
            "name": name,
            "age": age
        },  # context上下文对象，字典
    )


if __name__ == '__main__':
    uvicorn.run("main:app", port=8090, reload=True)
